package com.sanyang.lawyer.service.hr;

import com.sanyang.lawyer.entity.HrDegree;
import com.sanyang.lawyer.mapper.hr.HrdegreeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HrdegreeService {
    @Autowired
    private HrdegreeMapper hrdegreeMapper;


    public int save(HrDegree hrDegree){
        return hrdegreeMapper.insert(hrDegree);
    }

    public List<HrDegree> getByid(int id){
        return  hrdegreeMapper.getByid(id);
    }

    public HrDegree degreeid(int id){
        return hrdegreeMapper.workgetByid(id);
    }

    public int update(HrDegree hrDegree){
        return this.hrdegreeMapper.updateById(hrDegree);

    }
    public Integer delete(String empId){
        String[]arr=empId.split(",");
        int j=0;
        for (int i=0;i<arr.length;i++){
            hrdegreeMapper.deleteById(Integer.parseInt(arr[i]));
            j++;
        }
        if(j>0){
            return 1;
        }else{
            return 0;
        }
    }
}
